<!DOCTYPE html>

































































<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="shortcut icon" type="image/x-icon" href="../../../favicon.ico" />
<title>Intents and Intent Filters | Android Developers</title>
<link href="../../../assets/android-developer-docs-devguide.css" rel="stylesheet" type="text/css" />
<script src="../../../assets/search_autocomplete.js" type="text/javascript"></script>
<script src="../../../assets/jquery-resizable.min.js" type="text/javascript"></script>
<script src="../../../assets/android-developer-docs.js" type="text/javascript"></script>
<script src="../../../assets/prettify.js" type="text/javascript"></script>
<script type="text/javascript">
  setToRoot("../../../");
</script>
<noscript>
  <style type="text/css">
    html,body{overflow:auto;}
    #body-content{position:relative; top:0;}
    #doc-content{overflow:visible;border-left:3px solid #666;}
    #side-nav{padding:0;}
    #side-nav .toggle-list ul {display:block;}
    #resize-packages-nav{border-bottom:3px solid #666;}
  </style>
</noscript>
</head>
<body class="gc-documentation">

  <div id="header">
      <div id="headerLeft">
          <a href="../../../index.html" tabindex="-1"><img
              src="../../../assets/images/bg_logo.png" alt="Android Developers" /></a>
          <ul id="header-tabs" class="guide">
    
	<li id="home-link"><a href="../../../offline.html">
	
		<span class="en">Home</span>
		<span style="display:none" class="de">Startseite</span>
		<span style="display:none" class="es"></span>
		<span style="display:none" class="fr"></span>
		<span style="display:none" class="it"></span>
		<span style="display:none" class="ja">ホーム</span>
		<span style="display:none" class="zh-CN">主页</span>
		<span style="display:none" class="zh-TW">首頁</span>
	
	</a></li>
	<li id="sdk-link"><a href="../../../sdk/index.html">
		<span class="en">SDK</span>
	</a></li>
	<li id="guide-link"><a href="../../../guide/index.html" onClick="return loadLast('guide')">
	
		<span class="en">Dev Guide</span>
		<span style="display:none" class="de">Handbuch</span>
		<span style="display:none" class="es">Guía</span>
		<span style="display:none" class="fr">Guide</span>
		<span style="display:none" class="it">Guida</span>
		<span style="display:none" class="ja">開発ガイド</span>
		<span style="display:none" class="zh-CN">开发人员指南</span>
		<span style="display:none" class="zh-TW">開發指南</span>
	
	</a></li>
	<li id="reference-link"><a href="../../../reference/packages.html" onClick="return loadLast('reference')">
	
		<span class="en">Reference</span>
		<span style="display:none" class="de">Referenz</span>
		<span style="display:none" class="es">Referencia</span>
		<span style="display:none" class="fr">Référence</span>
		<span style="display:none" class="it">Riferimento</span>
		<span style="display:none" class="ja">リファレンス</span>
		<span style="display:none" class="zh-CN">参考</span>
		<span style="display:none" class="zh-TW">參考資料</span>
	
	</a></li>
	<li id="resources-link"><a href="../../../resources/index.html" onClick="return loadLast('resources')">
	
		<span class="en">Resources</span>
		<span style="display:none" class="de"></span>
		<span style="display:none" class="es"></span>
		<span style="display:none" class="fr"></span>
		<span style="display:none" class="it"></span>
    		<span style="display:none" class="ja"></span>
		<span style="display:none" class="zh-CN"></span>
		<span style="display:none" class="zh-TW"></span>
	
	</a></li>
	<li id="videos-link"><a href="../../../videos/index.html" onClick="return loadLast('videos')">
	
		<span class="en">Videos</span>
		<span style="display:none" class="de"></span>
		<span style="display:none" class="es"></span>
		<span style="display:none" class="fr"></span>
		<span style="display:none" class="it"></span>
		<span style="display:none" class="ja">ビデオ</span>
		<span style="display:none" class="zh-CN"></span>
		<span style="display:none" class="zh-TW"></span>
	
	</a></li>
	<li><a href="http://android-developers.blogspot.com" onClick="return requestAppendHL(this.href)">
	
		<span class="en">Blog</span>
		<span style="display:none" class="de"></span>
		<span style="display:none" class="es"></span>
		<span style="display:none" class="fr"></span>
		<span style="display:none" class="it"></span>
		<span style="display:none" class="ja">ブログ</span>
		<span style="display:none" class="zh-CN">博客</span>
		<span style="display:none" class="zh-TW">網誌</span>
	
	</a></li>


     
</ul>
     
      </div>
      <div id="headerRight">
          <div id="headerLinks">
          
          <a href="http://www.android.com">Android.com</a>
          </div>
  <div id="search" >
      <div id="searchForm">
          <form accept-charset="utf-8" class="gsc-search-box" 
                onsubmit="return submit_search()">
            <table class="gsc-search-box" cellpadding="0" cellspacing="0"><tbody>
                <tr>
                  <td class="gsc-input">
                    <input id="search_autocomplete" class="gsc-input" type="text" size="33" autocomplete="off"
                      title="search developer docs" name="q"
                      value="search developer docs"
                      onFocus="search_focus_changed(this, true)"
                      onBlur="search_focus_changed(this, false)"
                      onkeydown="return search_changed(event, true, '../../../')"
                      onkeyup="return search_changed(event, false, '../../../')" />
                  <div id="search_filtered_div" class="no-display">
                      <table id="search_filtered" cellspacing=0>
                      </table>
                  </div>
                  </td>
                  <td class="gsc-search-button">
                    <input type="submit" value="Search" title="search" id="search-button" class="gsc-search-button" />
                  </td>
                  <td class="gsc-clear-button">
                    <div title="clear results" class="gsc-clear-button">&nbsp;</div>
                  </td>
                </tr></tbody>
              </table>
          </form>
      </div><!-- searchForm -->
  </div><!-- search -->
      </div><!-- headerRight -->
      <script type="text/javascript">
        <!--  
        changeTabLang(getLangPref());
        //-->
      </script>
  </div><!-- header -->

  <div class="g-section g-tpl-240" id="body-content">
    <div class="g-unit g-first" id="side-nav">
      <div id="devdoc-nav">
<ul>

  <li>
    <h2><span class="en">Android Basics</span>
        <span class="de" style="display:none">Einführung in Android</span>
        <span class="es" style="display:none">Información básica sobre Android</span>
        <span class="fr" style="display:none">Présentation d'Android</span>
        <span class="it" style="display:none">Nozioni di base su Android</span>
        <span class="ja" style="display:none">Android の基本</span>
        <span class="zh-CN" style="display:none">Android 基础知识</span>
        <span class="zh-TW" style="display:none">Android 簡介</span>
    </h2>
    <ul>
      <li><a href="../../../guide/basics/what-is-android.html">
        <span class="en">What Is Android?</span>
        <span class="de" style="display:none">Was ist Android?</span>
        <span class="es" style="display:none">¿Qué es Android?</span>
        <span class="fr" style="display:none">Qu'est-ce qu'Android&nbsp;?</span>
        <span class="it" style="display:none">Che cos'è Android?</span>
        <span class="ja" style="display:none">Android とは</span>
        <span class="zh-CN" style="display:none">Android 是什么？</span>
        <span class="zh-TW" style="display:none">什麼是 Android？</span>
          </a></li>
      <li><a href="../../../guide/topics/fundamentals.html">
        <span class="en">Application Fundamentals</span>
        <span class="de" style="display:none">Anwendungsgrundlagen</span>
        <span class="es" style="display:none">Fundamentos de las aplicaciones</span>
        <span class="fr" style="display:none">Principes de base des applications</span>
        <span class="it" style="display:none">Concetti fondamentali sulle applicazioni</span>
        <span class="ja" style="display:none">開発の基礎</span>
        <span class="zh-CN" style="display:none">应用程序基础</span>
        <span class="zh-TW" style="display:none">應用程式基本原理</span>
      </a></li>

  <!--  <li><a style="color:gray;">The Android SDK</a></li> -->
  <!--  <li><a style="color:gray;">Walkthrough for Developers</a></li> -->
      <!-- quick overview of what it's like to develop on Android -->
    </ul>
  </li>

  <li>
    <h2>
      <span class="en">Framework Topics</span>
      <span class="de" style="display:none">Framework-Themen</span>
      <span class="es" style="display:none">Temas sobre el framework</span>
      <span class="fr" style="display:none">Thèmes relatifs au framework</span>
      <span class="it" style="display:none">Argomenti relativi al framework</span>
      <span class="ja" style="display:none">フレームワーク トピック</span>
      <span class="zh-CN" style="display:none">框架主题</span>
      <span class="zh-TW" style="display:none">架構主題</span>
    </h2>
    <ul>
      <li class="toggle-list">
        <div><a href="../../../guide/topics/fundamentals/activities.html">
          <span class="en">Activities</span>
        </a></div>
        <ul>
          <li><a href="../../../guide/topics/fundamentals/fragments.html">
            <span class="en">Fragments</span>
          </a></li>
          <li><a href="../../../guide/topics/fundamentals/loaders.html">
            <span class="en">Loaders</span>
          </a></li>
          <li><a href="../../../guide/topics/fundamentals/tasks-and-back-stack.html">
            <span class="en">Tasks and Back Stack</span></a></li>
        </ul>
      </li>
      <li class="toggle-list">
        <div><a href="../../../guide/topics/fundamentals/services.html">
          <span class="en">Services</span>
        </a></div>
        <ul>
          <li><a href="../../../guide/topics/fundamentals/bound-services.html">
            <span class="en">Bound Services</span>
          </a></li>
        </ul>
      </li>
      <li><a href="../../../guide/topics/providers/content-providers.html">
            <span class="en">Content Providers</span>
          </a></li>
      <li><a href="../../../guide/topics/intents/intents-filters.html">
            <span class="en">Intents and Intent Filters</span>
          </a></li>
      <li><a href="../../../guide/topics/fundamentals/processes-and-threads.html">
            <span class="en">Processes and Threads</span>
          </a></li>
    </ul>


    <ul>
      <li class="toggle-list">
        <div><a href="../../../guide/topics/ui/index.html">
            <span class="en">User Interface</span>
          </a></div>
        <ul>
          <li><a href="../../../guide/topics/ui/declaring-layout.html">
               <span class="en">XML Layouts</span>
              </a></li>
          <li><a href="../../../guide/topics/ui/ui-events.html">
                <span class="en">Input Events</span>
              </a></li>
          <li><a href="../../../guide/topics/ui/menus.html">
               <span class="en">Menus</span>
              </a></li>
          <li><a href="../../../guide/topics/ui/actionbar.html">
               <span class="en">Action Bar</span>
              </a></li>
          <li><a href="../../../guide/topics/ui/dialogs.html">
                <span class="en">Dialogs</span>
              </a></li>
          <li class="toggle-list">
            <div><a href="../../../guide/topics/ui/notifiers/index.html">
                <span class="en">Notifications</span>
            </a></div>
            <ul>
              <li><a href="../../../guide/topics/ui/notifiers/toasts.html">
                <span class="en">Toast Notifications</span>
              </a></li>
              <li><a href="../../../guide/topics/ui/notifiers/notifications.html">
                <span class="en">Status Bar Notifications</span>
              </a></li>
            </ul>
          </li>
          <li><a href="../../../guide/topics/ui/drag-drop.html">
                <span class="en">Drag and Drop</span>
              </a></li>
          <li><a href="../../../guide/topics/ui/themes.html">
                <span class="en">Styles and Themes</span>
              </a></li>
          <li><a href="../../../guide/topics/ui/custom-components.html">
                <span class="en">Custom Components</span>
              </a></li>
          <li><a href="../../../guide/topics/ui/binding.html">
                <span class="en">Binding to Data with AdapterView</span>
              </a></li>
          <li><a href="../../../guide/topics/ui/layout-objects.html">
                <span class="en">Common Layout Objects</span>
              </a></li>
          <li><a href="../../../guide/topics/ui/how-android-draws.html">
                <span class="en">How Android Draws Views</span>
              </a></li>
        </ul>
      </li><!-- end of User Interface -->

      <li class="toggle-list">
        <div><a href="../../../guide/topics/resources/index.html">
               <span class="en">Application Resources</span>
             </a></div>
        <ul>
          <li><a href="../../../guide/topics/resources/providing-resources.html">
                <span class="en">Providing Resources</span>
              </a></li>
          <li><a href="../../../guide/topics/resources/accessing-resources.html">
                <span class="en">Accessing Resources</span>
              </a></li>
          <li><a href="../../../guide/topics/resources/runtime-changes.html">
                <span class="en">Handling Runtime Changes</span>
              </a></li>
          <li><a href="../../../guide/topics/resources/localization.html">
                <span class="en">Localization</span>
              </a></li>
          <li class="toggle-list">
            <div><a href="../../../guide/topics/resources/available-resources.html">
              <span class="en">Resource Types</span>
            </a></div>
            <ul>
              <li><a href="../../../guide/topics/resources/animation-resource.html">Animation</a></li>
              <li><a href="../../../guide/topics/resources/color-list-resource.html">Color State List</a></li>
              <li><a href="../../../guide/topics/resources/drawable-resource.html">Drawable</a></li>
              <li><a href="../../../guide/topics/resources/layout-resource.html">Layout</a></li>
              <li><a href="../../../guide/topics/resources/menu-resource.html">Menu</a></li>
              <li><a href="../../../guide/topics/resources/string-resource.html">String</a></li>
              <li><a href="../../../guide/topics/resources/style-resource.html">Style</a></li>
              <li><a href="../../../guide/topics/resources/more-resources.html">More Types</a></li>
            </ul>
          </li><!-- end of resource types -->
        </ul>
      </li><!-- end of app resources -->
      <li class="toggle-list">
        <div><a href="../../../guide/topics/data/data-storage.html">
            <span class="en">Data Storage</span>
          </a></div>
          <ul>
            <li><a href="../../../guide/topics/data/backup.html">
                <span class="en">Data Backup</span>
              </a>
            </li>
          </ul>
      </li>
      <li><a href="../../../guide/topics/security/security.html">
            <span class="en">Security and Permissions</span>
          </a></li>
      <li class="toggle-list">
        <div><a href="../../../guide/topics/manifest/manifest-intro.html">
          <span class="en">The AndroidManifest.xml File</span>
        </a></div>
        <ul>
          <li><a href="../../../guide/topics/manifest/action-element.html">&lt;action&gt;</a></li>
          <li><a href="../../../guide/topics/manifest/activity-element.html">&lt;activity&gt;</a></li>
          <li><a href="../../../guide/topics/manifest/activity-alias-element.html">&lt;activity-alias&gt;</a></li>
          <li><a href="../../../guide/topics/manifest/application-element.html">&lt;application&gt;</a></li>
          <li><a href="../../../guide/topics/manifest/category-element.html">&lt;category&gt;</a></li>
          <li><a href="../../../guide/topics/manifest/compatible-screens-element.html">&lt;compatible-screens&gt;</a></li>
          <li><a href="../../../guide/topics/manifest/data-element.html">&lt;data&gt;</a></li>
          <li><a href="../../../guide/topics/manifest/grant-uri-permission-element.html">&lt;grant-uri-permission&gt;</a></li>
          <li><a href="../../../guide/topics/manifest/instrumentation-element.html">&lt;instrumentation&gt;</a></li>
          <li><a href="../../../guide/topics/manifest/intent-filter-element.html">&lt;intent-filter&gt;</a></li>
          <li><a href="../../../guide/topics/manifest/manifest-element.html">&lt;manifest&gt;</a></li>
          <li><a href="../../../guide/topics/manifest/meta-data-element.html">&lt;meta-data&gt;</a></li>
          <li><a href="../../../guide/topics/manifest/path-permission-element.html">&lt;path-permission&gt;</a></li>
          <li><a href="../../../guide/topics/manifest/permission-element.html">&lt;permission&gt;</a></li>
          <li><a href="../../../guide/topics/manifest/permission-group-element.html">&lt;permission-group&gt;</a></li>
          <li><a href="../../../guide/topics/manifest/permission-tree-element.html">&lt;permission-tree&gt;</a></li>
          <li><a href="../../../guide/topics/manifest/provider-element.html">&lt;provider&gt;</a></li>
          <li><a href="../../../guide/topics/manifest/receiver-element.html">&lt;receiver&gt;</a></li>
          <li><a href="../../../guide/topics/manifest/service-element.html">&lt;service&gt;</a></li>
          <li><a href="../../../guide/topics/manifest/supports-gl-texture-element.html">&lt;supports-gl-texture&gt;</a></li>
          <li><a href="../../../guide/topics/manifest/supports-screens-element.html">&lt;supports-screens&gt;</a></li><!-- ##api level 4## -->
          <li><a href="../../../guide/topics/manifest/uses-configuration-element.html">&lt;uses-configuration&gt;</a></li>
          <li><a href="../../../guide/topics/manifest/uses-feature-element.html">&lt;uses-feature&gt;</a></li> <!-- ##api level 4## -->
          <li><a href="../../../guide/topics/manifest/uses-library-element.html">&lt;uses-library&gt;</a></li>
          <li><a href="../../../guide/topics/manifest/uses-permission-element.html">&lt;uses-permission&gt;</a></li>
          <li><a href="../../../guide/topics/manifest/uses-sdk-element.html">&lt;uses-sdk&gt;</a></li>
        </ul>
      </li><!-- end of the manifest file -->
    </ul>

    <ul>
    <li class="toggle-list">
        <div><a href="../../../guide/topics/graphics/index.html">
            <span class="en">Graphics</span>
          </a><span class="new-child">new!</span></div>
        <ul>
          <li><a href="../../../guide/topics/graphics/2d-graphics.html">
              <span class="en">Canvas and Drawables</span></a></li>
          <li><a href="../../../guide/topics/graphics/hardware-accel.html">
              <span class="en">Hardware Acceleration</span></a>
            <span class="new">new!</span></li>
          <li><a href="../../../guide/topics/graphics/opengl.html">
              <span class="en">OpenGL</span>
            </a><span class="new">updated</span></li>
        </ul>
      </li>
      <li class="toggle-list">
        <div><a href="../../../guide/topics/graphics/animation.html">
            <span class="en">Animation</span>
          </a></div>
        <ul>
          <li><a href="../../../guide/topics/graphics/prop-animation.html">
              <span class="en">Property Animation</span></a></li>
          <li><a href="../../../guide/topics/graphics/view-animation.html">
              <span class="en">View Animation</span></a></li>
          <li><a href="../../../guide/topics/graphics/drawable-animation.html">
              <span class="en">Drawable Animation</span></a></li>
        </ul>
      </li>
      <li class="toggle-list">
	        <div><a href="../../../guide/topics/renderscript/index.html">
	            <span class="en">RenderScript</span>
	          </a></div>
	        <ul>
	          <li><a href="../../../guide/topics/renderscript/graphics.html">
	                <span class="en">Graphics</span>
	              </a>
	          </li>
	          <li><a href="../../../guide/topics/renderscript/compute.html">
	                <span class="en">Compute</span>
	              </a>
	          </li>
	        </ul>
  	  </li>

      <li class="toggle-list">
          <div><a href="../../../guide/topics/media/index.html">
            <span class="en">Multimedia and Camera</span>
          </a><span class="new">updated</span></div>
          <ul>
            <li><a href="../../../guide/topics/media/mediaplayer.html">
                  <span class="en">Media Playback</span></a>
                </li>
            <li><a href="../../../guide/topics/media/jetplayer.html">
                  <span class="en">JetPlayer</span></a>
                </li>
            <li><a href="../../../guide/topics/media/camera.html">
                  <span class="en">Camera</span></a>
                  <span class="new">new!</span>
                </li>
            <li><a href="../../../guide/topics/media/audio-capture.html">
                  <span class="en">Audio Capture</span></a>
                </li>
          </ul>
      </li>
      <li>
        <a href="../../../guide/topics/clipboard/copy-paste.html">
            <span class="en">Copy and Paste</span>
        </a></li>
  <!--<li class="toggle-list">
        <div><a style="color:gray;">Sensors</a></div>
          <ul>
            <li><a style="color:gray;">Camera</a></li>
            <li><a style="color:gray;">Compass</a></li>
            <li><a style="color:gray;">Accelerometer</a></li>
          </ul>
      </li> -->
      <li class="toggle-list">
        <div><a href="../../../guide/topics/location/index.html">
               <span class="en">Location and Maps</span>
             </a></div>
        <ul>
          <li><a href="../../../guide/topics/location/obtaining-user-location.html">
                <span class="en">Obtaining User Location</span>
              </a></li>
        </ul>
      </li>
  <!--<li class="toggle-list">
        <div><a style="color:gray;">Wireless Controls</a></div>
          <ul>
            <li><a style="color:gray;">Wi-Fi</a></li>
          </ul>
      </li> -->
  <!--<li><a style="color:gray;">Localization</a></li>  -->
      <li><a href="../../../guide/topics/appwidgets/index.html">
            <span class="en">App Widgets</span></a>
          </li>
      <li><a href="../../../guide/topics/wireless/bluetooth.html">
            <span class="en">Bluetooth</span></a>
          </li>
      <li><a href="../../../guide/topics/nfc/index.html">
            <span class="en">Near Field Communication</span>
          </a></li>
      <li class="toggle-list">
          <div><a href="../../../guide/topics/usb/index.html">
            <span class="en">USB</span></a>
          </div>
            <ul>
              <li><a href="../../../guide/topics/usb/accessory.html">Accessory</a></li>
              <li><a href="../../../guide/topics/usb/host.html">Host</a></li>
              <li><a href="../../../guide/topics/usb/adk.html">Open Accessory Dev Kit</a></li>
            </ul>
          </li>

       <li><a href="../../../guide/topics/network/sip.html">
            <span class="en">Session Initiation Protocol</span>
          </a></li>
      <li class="toggle-list">
        <div><a href="../../../guide/topics/search/index.html">
            <span class="en">Search</span>
          </a></div>
          <ul>
            <li><a href="../../../guide/topics/search/search-dialog.html">Creating a Search Interface</a></li>
            <li><a href="../../../guide/topics/search/adding-recent-query-suggestions.html">Adding Recent Query Suggestions</a></li>
            <li><a href="../../../guide/topics/search/adding-custom-suggestions.html">Adding Custom Suggestions</a></li>
            <li><a href="../../../guide/topics/search/searchable-config.html">Searchable Configuration</a></li>
          </ul>
      </li>
      <li><a href="../../../guide/topics/admin/device-admin.html">
            <span class="en">Device Administration</span></a>
      </li>
      <li class="toggle-list">
           <div>
                <a href="../../../guide/topics/testing/index.html">
                   <span class="en">Testing</span>
               </a>
           </div>
           <ul>
              <li>
                <a href="../../../guide/topics/testing/testing_android.html">
                <span class="en">Testing Fundamentals</span></a>
              </li>
              <li>
                <a href="../../../guide/topics/testing/activity_testing.html">
                <span class="en">Activity Testing</span></a>
              </li>
              <li>
                <a href="../../../guide/topics/testing/contentprovider_testing.html">
                <span class="en">Content Provider Testing</span></a>
              </li>
              <li>
                <a href="../../../guide/topics/testing/service_testing.html">
                <span class="en">Service Testing</span></a>
              </li>
              <li>
                <a href="../../../guide/topics/testing/what_to_test.html">
                <span class="en">What To Test</span></a>
              </li>
           </ul>
      </li>
    </ul>
  </li>

  <li>
    <h2>
      <span class="en">Android Market Topics</span>
    </h2>
    <ul>
      <li><a href="../../../guide/publishing/licensing.html">
          <span class="en">Application Licensing</span></a>
      </li>
      <li class="toggle-list">
        <div><a href="../../../guide/market/billing/index.html">
            <span class="en">In-app Billing</span></a>
        </div>
        <ul>
          <li><a href="../../../guide/market/billing/billing_overview.html">
              <span class="en">In-app Billing Overview</span></a>
          </li>
          <li><a href="../../../guide/market/billing/billing_integrate.html">
              <span class="en">Implementing In-app Billing</span></a>
          </li>
          <li><a href="../../../guide/market/billing/billing_best_practices.html">
              <span class="en">Security and Design</span></a>
          </li>
          <li><a href="../../../guide/market/billing/billing_testing.html">
              <span class="en">Testing In-app Billing</span></a>
          </li>
          <li><a href="../../../guide/market/billing/billing_admin.html">
              <span class="en">Administering In-app Billing</span></a>
          </li>
          <li><a href="../../../guide/market/billing/billing_reference.html">
              <span class="en">In-app Billing Reference</span></a>
          </li>
        </ul>
      </li>
      <li><a href="../../../guide/appendix/market-filters.html">
          <span class="en">Market Filters</span></a>
      </li>
      <li><a href="../../../guide/market/publishing/multiple-apks.html">
          <span class="en">Multiple APK Support</span></a>
      </li>
    </ul>
  </li>


  <li>
    <h2><span class="en">Developing</span>
               <span class="de" style="display:none">Entwicklung</span>
               <span class="es" style="display:none">Desarrollo</span>
               <span class="fr" style="display:none">Développement</span>
               <span class="it" style="display:none">Sviluppo</span>
               <span class="ja" style="display:none">開発</span>
               <span class="zh-CN" style="display:none">开发</span>
               <span class="zh-TW" style="display:none">開發</span>
    </h2>
    <ul>
  <!--<li><a href="">Developing for Android</a></li>
      signing, upgrading, selecting a package name, select device profile, touch, trackball, dpad available, etc. -->
      <li>
        <a href="../../../guide/developing/index.html">
        <span class="en">Introduction</span></a>
      </li>

      <li class="toggle-list">
        <div>
           <a href="../../../guide/developing/devices/index.html">
                <span class="en">Managing Virtual Devices</span>
            </a>
        </div>
        <ul>
          <li>
            <a href="../../../guide/developing/devices/managing-avds.html">
              <span class="en">With AVD Manager</span>
            </a>
          </li>
          <li>
            <a href="../../../guide/developing/devices/managing-avds-cmdline.html">
              <span class="en">From the Command Line</span>
            </a>
          </li>
          <li>
           <a href="../../../guide/developing/devices/emulator.html">
                <span class="en">Using the Android Emulator</span>
            </a>
          </li>
        </ul>
      </li>
      <li>
        <a href="../../../guide/developing/device.html">
          <span class="en">Using Hardware Devices</span>
        </a>
      </li>

      <li class="toggle-list">
        <div>
          <a href="../../../guide/developing/projects/index.html">
            <span class="en">Managing Projects</span>
          </a>
        </div>
        <ul>
          <li>
            <a href="../../../guide/developing/projects/projects-eclipse.html">
              <span class="en">From Eclipse with ADT</span>
            </a>
          </li>
          <li>
            <a href="../../../guide/developing/projects/projects-cmdline.html">
                <span class="en">From the Command Line</span>
            </a>
          </li>
        </ul>
      </li>

      <li class="toggle-list">
        <div>
          <a href="../../../guide/developing/building/index.html">
            <span class="en">Building and Running</span>
          </a>
        </div>
        <ul>
          <li><a href="../../../guide/developing/building/building-eclipse.html">
            <span class="en">From Eclipse with ADT</span>
          </a></li>
          <li><a href="../../../guide/developing/building/building-cmdline.html">
            <span class="en">From the Command Line</span></a></li>
        </ul>
      </li>

      <li class="toggle-list">
        <div>
          <a href="../../../guide/developing/debugging/index.html">
            <span class="en">Debugging</span>
          </a>
        </div>
        <ul>
          <li>
            <a href="../../../guide/developing/debugging/debugging-projects.html">
                <span class="en">From Eclipse with ADT</span>
            </a>
          </li>
          <li>
            <a href="../../../guide/developing/debugging/debugging-projects-cmdline.html">
                <span class="en">From Other IDEs</span>
            </a>
          </li>
          <li>
            <a href="../../../guide/developing/debugging/ddms.html">
              <span class="en">Using DDMS</span>
            </a>
          </li>
          <li>
            <a href="../../../guide/developing/debugging/debugging-log.html">
                <span class="en">Reading and Writing Logs</span>
            </a>
          </li>
          <li>
            <a href="../../../guide/developing/debugging/debugging-ui.html">
                <span class="en">Debugging and Profiling UIs</span>
            </a>
          </li>
          <li>
            <a href="../../../guide/developing/debugging/debugging-tracing.html">
                <span class="en">Profiling with Traceview and dmtracedump</span>
            </a>
          </li>
          <li>
            <a href="../../../guide/developing/debugging/debugging-devtools.html">
                <span class="en">Using the Dev Tools App</span>
            </a>
          </li>
        </ul>
      </li>

      <li class="toggle-list">
           <div>
                <a href="../../../guide/developing/testing/index.html">
                   <span class="en">Testing</span>
               </a>
           </div>
           <ul>
              <li>
                <a href="../../../guide/developing/testing/testing_eclipse.html">
                  <span class="en">From Eclipse with ADT</span>
                </a>
              </li>

              <li>
                <a href="../../../guide/developing/testing/testing_otheride.html">
                  <span class="en">From Other IDEs</span>
                </a>
              </li>
           </ul>
         </li>

         <li class="toggle-list">
        <div><a href="../../../guide/developing/tools/index.html">
            <span class="en">Tools</span>
          </a></div>
        <ul>
          <li><a href="../../../guide/developing/tools/adb.html">adb</a></li>
          <li><a href="../../../guide/developing/tools/adt.html">ADT</a></li>
          <li><a href="../../../guide/developing/tools/android.html">android</a></li>
          <li><a href="../../../guide/developing/tools/bmgr.html">bmgr</a>
          <li><a href="../../../guide/developing/tools/dmtracedump.html">dmtracedump</a></li>
          <li><a href="../../../guide/developing/tools/draw9patch.html">Draw
          9-Patch</a></li>
          <li><a href="../../../guide/developing/tools/emulator.html">Emulator</a></li>
          <li><a href="../../../guide/developing/tools/etc1tool.html">etc1tool</a></li>
          <li><a href="../../../guide/developing/tools/hierarchy-viewer.html">Hierarchy Viewer</a></li>
          <li><a href="../../../guide/developing/tools/hprof-conv.html">hprof-conv</a></li>
          <li><a href="../../../guide/developing/tools/layoutopt.html">layoutopt</a></li>
          <li><a href="../../../guide/developing/tools/logcat.html">logcat</a></li>
          <li><a href="../../../guide/developing/tools/mksdcard.html">mksdcard</a></li>
          <li><a href="../../../guide/developing/tools/monkey.html">Monkey</a></li>
          <li class="toggle-list">
            <div><a href="../../../guide/developing/tools/monkeyrunner_concepts.html">
              <span class="en">monkeyrunner</span>
            </a></div>
            <ul>
              <li><a href="../../../guide/developing/tools/MonkeyDevice.html">
                <span class="en">MonkeyDevice</span>
                </a></li>
              <li><a href="../../../guide/developing/tools/MonkeyImage.html">
                <span class="en">MonkeyImage</span>
                </a></li>
              <li><a href="../../../guide/developing/tools/MonkeyRunner.html">
                <span class="en">MonkeyRunner</span>
                </a></li>
            </ul>
          </li>
          <li><a href="../../../guide/developing/tools/proguard.html">ProGuard</a></li>
          <li><a href="../../../guide/developing/tools/adb.html#sqlite">sqlite3</a></li>
          <li><a href="../../../guide/developing/tools/traceview.html">Traceview</a></li>
          <li><a href="../../../guide/developing/tools/zipalign.html">zipalign</a></li>
        </ul>
      </li>
    </ul>
  </li>

  <li>
    <h2><span class="en">Publishing</span>
        <span class="de" style="display:none">Veröffentlichung</span>
        <span class="es" style="display:none">Publicación</span>
        <span class="fr" style="display:none">Publication</span>
        <span class="it" style="display:none">Pubblicazione</span>
        <span class="ja" style="display:none">公開</span>
        <span class="zh-CN" style="display:none">发布</span>
        <span class="zh-TW" style="display:none">發佈</span>
    </h2>
    <ul>
      <li><a href="../../../guide/publishing/app-signing.html">
            <span class="en">Signing Your Applications</span>
            <span class="de" style="display:none">Signieren Ihrer Anwendungen</span>
            <span class="es" style="display:none">Firma de aplicaciones</span>
            <span class="fr" style="display:none">Attribution de votre signature <br />à vos applications</span>
            <span class="it" style="display:none">Firma delle applicazioni</span>
            <span class="ja" style="display:none">アプリケーションへの署名</span>
            <span class="zh-CN" style="display:none">应用程序签名</span>
            <span class="zh-TW" style="display:none">簽署應用程式</span>
          </a></li>
      <li><a href="../../../guide/publishing/versioning.html">
            <span class="en">Versioning Your Applications</span>
            <span class="de" style="display:none">Versionsverwaltung für Ihre <br />Anwendungen</span>
            <span class="es" style="display:none">Versiones de las aplicaciones</span>
            <span class="fr" style="display:none">Attribution d'une version à vos applications</span>
            <span class="it" style="display:none">Controllo versioni delle applicazioni</span>
            <span class="ja" style="display:none">アプリケーションのバージョニング</span>
            <span class="zh-CN" style="display:none">应用程序版本控制</span>
            <span class="zh-TW" style="display:none">應用程式版本設定</span>
          </a></li>
      <li><a href="../../../guide/publishing/preparing.html">
            <span class="en">Preparing to Publish</span>
            <span class="de" style="display:none">Vorbereitung auf die Veröffentlichung</span>
            <span class="es" style="display:none">Publicación de aplicaciones</span>
            <span class="fr" style="display:none">Préparation à la publication</span>
            <span class="it" style="display:none">Preparativi per la pubblicazione</span>
            <span class="ja" style="display:none">公開の準備</span>
            <span class="zh-CN" style="display:none">准备发布</span>
            <span class="zh-TW" style="display:none">準備發佈</span>
          </a></li>
      <li><a href="../../../guide/publishing/publishing.html">
            <span class="en">Publishing on Android Market</span>
          </a></li>
    </ul>
  </li>

  <li>
    <h2><span class="en">Best Practices</span>
               <span class="de" style="display:none">Bewährte Verfahren</span>
               <span class="es" style="display:none">Prácticas recomendadas</span>
               <span class="fr" style="display:none">Meilleures pratiques</span>
               <span class="it" style="display:none">Best practice</span>
               <span class="ja" style="display:none">ベスト プラクティス</span>
               <span class="zh-CN" style="display:none">最佳实践</span>
               <span class="zh-TW" style="display:none">最佳實務</span>
    </h2>
    <ul>
      <li><a href="../../../guide/practices/compatibility.html">
            <span class="en">Compatibility</span>
          </a></li>
      <li class="toggle-list">
        <div><a href="../../../guide/practices/screens_support.html">
          <span class="en">Supporting Multiple Screens</span>
        </a></div>
        <ul>
          <li><a href="../../../guide/practices/screens-distribution.html">
            <span class="en">Distributing to Specific Screens</span>
          </a></li>
          <li><a href="../../../guide/practices/screen-compat-mode.html">
            <span class="en">Screen Compatibility Mode</span>
          </a></li>
          <li><a href="../../../guide/practices/screens-support-1.5.html">
            <span class="en">Strategies for Android 1.5</span>
          </a></li>
        </ul>
      </li>
      <li><a href="../../../guide/practices/optimizing-for-3.0.html">
            <span class="en">Optimizing Apps for Android 3.0</span>
          </a></li>
      <li class="toggle-list">
        <div><a href="../../../guide/practices/ui_guidelines/index.html">
               <span class="en">UI Guidelines</span>
             </a></div>
        <ul>
          <li class="toggle-list">
            <div><a href="../../../guide/practices/ui_guidelines/icon_design.html">
                   <span class="en">Icon Design <span class="new">updated</span></span>
                 </a></div>
            <ul>
              <li><a href="../../../guide/practices/ui_guidelines/icon_design_launcher.html">
                    <span class="en">Launcher Icons <span class="new">updated</span></span>
                  </a></li>
              <li><a href="../../../guide/practices/ui_guidelines/icon_design_menu.html">
                    <span class="en">Menu Icons</span>
                  </a></li>
              <li><a href="../../../guide/practices/ui_guidelines/icon_design_action_bar.html">
                    <span class="en">Action Bar Icons <span class="new">new!</span></span>
                  </a></li>
              <li><a href="../../../guide/practices/ui_guidelines/icon_design_status_bar.html">
                    <span class="en">Status Bar Icons <span class="new">updated</span></span>
                  </a></li>
              <li><a href="../../../guide/practices/ui_guidelines/icon_design_tab.html">
                    <span class="en">Tab Icons</span>
                  </a></li>
              <li><a href="../../../guide/practices/ui_guidelines/icon_design_dialog.html">
                    <span class="en">Dialog Icons</span>
                  </a></li>
              <li><a href="../../../guide/practices/ui_guidelines/icon_design_list.html">
                    <span class="en">List View Icons</span>
                  </a></li>
            </ul>
          </li>
          <li><a href="../../../guide/practices/ui_guidelines/widget_design.html">
                <span class="en">App Widget Design <span class="new">updated</span></span>
              </a></li>
          <li><a href="../../../guide/practices/ui_guidelines/activity_task_design.html">
                <span class="en">Activity and Task Design</span>
              </a></li>
          <li><a href="../../../guide/practices/ui_guidelines/menu_design.html">
                <span class="en">Menu Design</span>
              </a></li>
        </ul>
      </li>
      </ul>
      <ul>
      <li><a href="../../../guide/practices/design/accessibility.html">
            <span class="en">Designing for Accessibility</span>
          </a></li>
      <li class="toggle-list">
        <div><a href="../../../guide/practices/design/performance.html">
            <span class="en">Designing for Performance</span>
          </a></div>
        <ul>
          <li><a href="../../../guide/practices/design/jni.html">
                <span class="en">JNI Tips</span>
              </a></li>
        </ul>
      </li>
      <li><a href="../../../guide/practices/design/responsiveness.html">
            <span class="en">Designing for Responsiveness</span>
          </a></li>
      <li><a href="../../../guide/practices/design/seamlessness.html">
            <span class="en">Designing for Seamlessness</span>
          </a></li>
    </ul>
  </li>

  <li>
    <h2><span class="en">Web Applications</span>
    </h2>
    <ul>
      <li><a href="../../../guide/webapps/index.html">
            <span class="en">Web Apps Overview</span>
          </a></li>
      <li><a href="../../../guide/webapps/targeting.html">
            <span class="en">Targeting Screens from Web Apps</span>
          </a></li>
      <li><a href="../../../guide/webapps/webview.html">
            <span class="en">Building Web Apps in WebView</span>
          </a></li>
      <li><a href="../../../guide/webapps/debugging.html">
            <span class="en">Debugging Web Apps</span>
          </a></li>
      <li><a href="../../../guide/webapps/best-practices.html">
            <span class="en">Best Practices for Web Apps</span>
          </a></li>
    </ul>
  </li>

  <li>
    <h2><span class="en">Appendix</span>
               <span class="de" style="display:none">Anhang</span>
               <span class="es" style="display:none">Apéndice</span>
               <span class="fr" style="display:none">Annexes</span>
               <span class="it" style="display:none">Appendice</span>
               <span class="ja" style="display:none">付録</span>
               <span class="zh-CN" style="display:none">附录</span>
               <span class="zh-TW" style="display:none">附錄</span>
    </h2>
    <ul>
      <li><a href="../../../guide/appendix/api-levels.html">
            <span class="en">Android API Levels</span>
          </a></li>
      <li><a href="../../../guide/appendix/install-location.html">
            <span class="en">App Install Location</span>
          </a></li>
      <li><a href="../../../guide/appendix/media-formats.html">
            <span class="en">Supported Media Formats <span class="new">updated</span></span>
          </a></li>
      <li><a href="../../../guide/appendix/g-app-intents.html">
            <span class="en">Intents List: Google Apps</span>
          </a></li>
      <li><a href="../../../guide/developing/tools/aidl.html">AIDL</a></li>
      <li><a href="../../../guide/appendix/glossary.html">
            <span class="en">Glossary</span>
          </a></li>
    </ul>
  </li>

</ul>

<script type="text/javascript">
<!--
    buildToggleLists();
    changeNavLang(getLangPref());
//-->
</script>

      </div>
    </div> <!-- end side-nav -->
    <script>
      addLoadEvent(function() {
        scrollIntoView("devdoc-nav");
        });
    </script>




<div class="g-unit" id="doc-content"><a name="top"></a>

<div id="jd-header" class="guide-header">
  <span class="crumb">
    &nbsp;
    
  </span>
<h1>Intents and Intent Filters</h1>
</div>

  <div id="jd-content">

    <div class="jd-descr">
    <div id="qv-wrapper">
<div id="qv">

<h2>In this document</h2>
<ol>
<li><a href="#iobjs">Intent Objects</a></li>
<li><a href="#ires">Intent Resolution</a></li>
<li style="margin-left: 2em"><a href="#ifs">Intent filters</a></li>
<li style="margin-left: 2em"><a href="#ccases">Common cases</a></li>
<li style="margin-left: 2em"><a href="#imatch">Using intent matching</a></li>
<li><a href="#npex">Note Pad Example</a></li>
</ol>

<h2>Key classes</h2>
<ol>
<li><code><a href="../../../reference/android/content/Intent.html">Intent</a></code></li>
<li><code><a href="../../../reference/android/content/IntentFilter.html">IntentFilter</a></code></li>
<li><code><a href="../../../reference/android/content/BroadcastReceiver.html">BroadcastReceiver</a></code></li>
<li><code><a href="../../../reference/android/content/pm/PackageManager.html">PackageManager</a></code></li>
</ol>

</div>
</div>


<p>
Three of the core components of an application &mdash; activities, services, and 
broadcast receivers &mdash; are activated through messages, called <i>intents</i>.   
Intent messaging is a facility for late run-time binding between components in the same 
or different applications.  The intent itself, an <code><a href="../../../reference/android/content/Intent.html">Intent</a></code> 
object, is a passive data structure holding an abstract description of an operation 
to be performed &mdash; or, often in the case of broadcasts, a description of something 
that has happened and is being announced.  There are separate mechanisms for 
delivering intents to each type of component: 
</p>
<p>三种应用程序基本组件——activity, service和broadcast receiver——是使用称为intent的消息来激活的。Intent消息传递是一种组件间运行时绑定的机制. intent是Intent对象, 它包含了需要做的操作的描述, 或者, 对于广播来说, 包含了正在通知的消息内容. 对于向这三种组件发送intent有不同的机制:</p>

<ul>
<li>An Intent object is passed to <code><code><a href="../../../reference/android/content/Context.html#startActivity(android.content.Intent)">Context.startActivity()</a></code></code> or <code><code><a href="../../../reference/android/app/Activity.html#startActivityForResult(android.content.Intent, int)">Activity.startActivityForResult()</a></code></code> to launch an activity or get an existing 
activity to do something new. (It can also be passed to 
<code><code><a href="../../../reference/android/app/Activity.html#setResult(int, android.content.Intent)">Activity.setResult()</a></code></code>
to return information to the activity that called <code>startActivityForResult()</code>.)
<p>使用Context.startActivity() 或 Activity.startActivityForResult(), 传入一个intent来启动一个activity. 使用 Activity.setResult(), 传入一个intent来从activity中返回结果.</p></li>

<li><p>An Intent object is passed to <code><code><a href="../../../reference/android/content/Context.html#startService(android.content.Intent)">Context.startService()</a></code></code> to initiate a service or deliver new instructions to an 
ongoing service.  Similarly, an intent can be passed to <code><code><a href="../../../reference/android/content/Context.html#bindService(android.content.Intent, android.content.ServiceConnection, int)">Context.bindService()</a></code></code> to establish a 
connection between the calling component and a target service.  It can optionally
initiate the service if it's not already running.</p>
<p>将intent对象传给Context.startService()来启动一个service或者传消息给一个运行的service. 将intent对象传给 Context.bindService()来绑定一个service.</p></li>

<li><p>Intent objects passed to any of the broadcast methods (such as <code><code><a href="../../../reference/android/content/Context.html#sendBroadcast(android.content.Intent)">Context.sendBroadcast()</a></code></code>, 
<code><code><a href="../../../reference/android/content/Context.html#sendOrderedBroadcast(android.content.Intent, java.lang.String)">Context.sendOrderedBroadcast()</a></code></code>, or <code><code><a href="../../../reference/android/content/Context.html#sendStickyBroadcast(android.content.Intent)">Context.sendStickyBroadcast()</a></code></code>) 
are delivered to all interested broadcast receivers.  Many kinds of broadcasts 
originate in system code.</p>
<p>将intent对象传给 Context.sendBroadcast(), Context.sendOrderedBroadcast(),或者Context.sendStickyBroadcast()等广播方法,则它们被传给 broadcast receiver.</p></li>
</ul>

<p>
In each case, the Android system finds the appropriate activity, service, or set 
of broadcast receivers to respond to the intent, instantiating them if necessary. 
There is no overlap within these messaging systems:  Broadcast intents are delivered 
only to broadcast receivers, never to activities or services.  An intent passed to 
<code>startActivity()</code> is delivered only to an activity, never to a service or 
broadcast receiver, and so on.
</p>
<p>在上述三种情况下, android系统会自己找到合适的activity, service, 或者  broadcast receivers来响应intent. 三者的intent相互独立互不干扰.</p>

<p>
This document begins with a description of Intent objects.  It then describes the 
rules Android uses to map intents to components &mdash; how it resolves which 
component should receive an intent message.  For intents that don't explicitly 
name a target component, this process involves testing the Intent object against 
<i>intent filters</i> associated with potential targets. 
</p>


<h2><a name="iobjs"></a>Intent Objects Intent对象</h2>

<p>
An <code><a href="../../../reference/android/content/Intent.html">Intent</a></code> object is a bundle of information.  It 
contains information of interest to the component that receives the intent 
(such as the action to be taken and the data to act on) plus information 
of interest to the Android system (such as the category of component that 
should handle the intent and instructions on how to launch a target activity).  
Principally, it can contain the following:
</p>
<p>一个intent对象包含了接受该intent的组件的信息(例如需要的动作和该动作需要的数据)和android系统所需要的信息(例如该组件的类别,以及如何启动它). 具体的说:</p>

<dl>

<dt><b>Component name 组件名称</b><a name="cname"></a></dt> 
<dd>The name of the component that should handle the intent.  This field is 
a <code><a href="../../../reference/android/content/ComponentName.html">ComponentName</a></code> object &mdash; a combination of the 
fully qualified class name of the target component (for example "<code>com.example.project.app.FreneticActivity</code>") and the package name set
in the manifest file of the application where the component resides (for 
example, "<code>com.example.project</code>").  The package part of the component 
name and the package name set in the manifest do not necessarily have to match.
<p>为一个ComponentName 对象. 它是目标组件的完整名(例如"com.example.project.app.FreneticActivity")和应用程序manifest文件设定的包名(例如"com.example.project")的组合.前者的包名部分和后者不一定一样.</p>

<p>  
The component name is optional.  If it is set, the Intent object is 
delivered to an instance of the designated class.  If it is not set, 
Android uses other information in the Intent object to locate a suitable 
target &mdash; see <a href="#ires">Intent Resolution</a>, later in this 
document.
</p>
<p>组件名称是可选的. 如果设定了的话, Intent对象会被传给指定的类的一个实例. 如果不设定, 则android使用其它信息来定位合适的目标.
</p>

<p>
The component name is set by <code><code><a href="../../../reference/android/content/Intent.html#setComponent(android.content.ComponentName)">setComponent()</a></code></code>,  <code><code><a href="../../../reference/android/content/Intent.html#setClass(android.content.Context, java.lang.Class<?>)">setClass()</a></code></code>, or <code><code><a href="../../../reference/android/content/Intent.html#setClassName(java.lang.String, java.lang.String)">setClassName()</a></code></code> and read by <code><code><a href="../../../reference/android/content/Intent.html#getComponent()">getComponent()</a></code></code>. 
</p>
<p>组件名称是使用setComponent(), setClass(),或  setClassName()来设定, 使用 getComponent()来获取.</p>
</dd>

<p><dt><b>Action</b></dt>
<dd>A string naming the action to be performed &mdash; or, in the case of broadcast 
intents, the action that took place and is being reported.  The Intent class defines 
a number of action constants, including these:
</p>
<p>一个字符串, 为请求的动作命名, 或者, 对于broadcast intent, 发生的并且正在被报告的动作.Intent类定义了许多action关联。例如:</p>

<table>
<tr>
   <th>Constant</th>
   <th>Target component</th>
   <th>Action</th>
</tr><tr>
   <td><code>ACTION_CALL</code>
   <td>activity
   <td>Initiate a phone call.发起一个电话呼叫. 
</tr><tr>
   <td><code>ACTION_EDIT</code>
   <td>activity
   <td>Display data for the user to edit.展示数据给用户编辑。
</tr><tr>
   <td><code>ACTION_MAIN</code>
   <td>activity
   <td>Start up as the initial activity of a task, with no data input and no returned output.将该activity作为一个task的第一个activity启动,不传入参数也不期望返回值.
</tr><tr>
   <td><code>ACTION_SYNC</code>
   <td>activity
   <td>Synchronize data on a server with data on the mobile device.将设备上的数据和一个服务器同步. 
</tr><tr>
   <td><code>ACTION_BATTERY_LOW</code>
   <td>broadcast receiver
   <td>A warning that the battery is low.电量低的警告。
</tr><tr>
   <td><code>ACTION_HEADSET_PLUG</code>
   <td>broadcast receiver
   <td>A headset has been plugged into the device, or unplugged from it.耳机被插入或拔出。
</tr><tr>
   <td><code>ACTION_SCREEN_ON</code>
   <td>broadcast receiver
   <td>The screen has been turned on.屏幕被打开
</tr><tr>
   <td><code>ACTION_TIMEZONE_CHANGED</code>
   <td>broadcast receiver
   <td>The setting for the time zone has changed.时区改变
</tr>
</table>

<p>
See the <code><a href="../../../reference/android/content/Intent.html">Intent</a></code> class description for a list of 
pre-defined constants for generic actions.  Other actions are defined 
elsewhere in the Android API.
You can also define your own action strings for activating the components 
in your application.  Those you invent should include the application 
package as a prefix &mdash; for example: 
"<code>com.example.project.SHOW_COLOR</code>". 
</p>
<p>你也可以定义自己的action字符串用来启动你的应用程序. 自定义的action应该包含应用程序的包名.例如"com.example.project.SHOW_COLOR".</p>

<p>
The action largely determines how the rest of the intent is structured
&mdash; particularly the <a href="#data">data</a> and 
<a href="#extras">extras</a> fields &mdash; 
much as a method name determines a set of arguments and a return value.
For this reason, it's a good idea to use action names that are
as specific as possible, and to couple them tightly to the other fields of
the intent.  In other words, instead of defining an action in isolation,
define an entire protocol for the Intent objects your components can handle.
</p>
<p>action很大程度上决定了intent的另外部分的结构, 就像一个方法名决定了它接受的参数和返回值一样. 因此, 最好给action一个最能反映其作用的名字.</p>

<p>
The action in an Intent object is set by the 
<code><code><a href="../../../reference/android/content/Intent.html#setAction(java.lang.String)">setAction()</a></code></code> 
method and read by 
<code><code><a href="../../../reference/android/content/Intent.html#getAction()">getAction()</a></code></code>.
</p>
<p>intent对象中的action是使用getAction()和setAction()来读写的.</p>
</dd>

<p><dt><b>Data 数据</b><a name="data"></a></dt>
<dd>The URI of the data to be acted on and the MIME type of that data.  Different 
actions are paired with different kinds of data specifications.  For example, if 
the action field is <code>ACTION_EDIT</code>, 
the data field would contain the URI of the document to be displayed for editing.  
If the action is <code>ACTION_CALL</code>, the data field would be a <code>tel:</code> URI 
with the number to call.  Similarly, if the action is <code>ACTION_VIEW</code> and the 
data field is an <code>http:</code> URI, the receiving activity would be called upon 
to download and display whatever data the URI refers to.
<p>需要操作的数据的URI和它的MIME(多用途互联网邮件扩展，Multipurpose Internet Mail Extensions)类型. 例如, 如果action为ACTION_EDIT, 那么Data将包含待编辑的数据URI. 如果action为ACTION_CALL, Data将为tel:电话号码的URI. 如果action为ACTION_VIEW, 则Data为http:网络地址的URI.</p>
<p>
When matching an intent to a component that is capable of handling the data, 
it's often important to know the type of data (its MIME type) in addition to its URI.  
For example, a component able to display image data should not be called
upon to play an audio file.
</p>

<p>
In many cases, the data type can be inferred from the URI &mdash; particularly 
<code>content:</code> URIs, which indicate that the data is located on the device and
controlled by a content provider (see the  
<a href="../../../guide/topics/providers/content-providers.html">separate 
discussion on content providers</a>).  But the type can also be explicitly set 
in the Intent object.  
The <code><code><a href="../../../reference/android/content/Intent.html#setData(android.net.Uri)">setData()</a></code></code> method specifies 
data only as a URI, <code><code><a href="../../../reference/android/content/Intent.html#setType(java.lang.String)">setType()</a></code></code> 
specifies it only as a MIME type, and <code><code><a href="../../../reference/android/content/Intent.html#setDataAndType(android.net.Uri, java.lang.String)">setDataAndType()</a></code></code> specifies it as both 
a URI and a MIME type.  The URI is read by <code><code><a href="../../../reference/android/content/Intent.html#getData()">getData()</a></code></code> and the type by <code><code><a href="../../../reference/android/content/Intent.html#getType()">getType()</a></code></code>.
</p>
</dd>

<p><dt><b>Category</b></dt>
<dd>A string containing additional information about the kind of component 
that should handle the intent.  Any number of category descriptions can be 
placed in an Intent object.  As it does for actions, the Intent class defines
several category constants, including these: 

<table>
<tr>
   <th>Constant</th>
   <th>Meaning</th>
</tr><tr>
   <td><code>CATEGORY_BROWSABLE</code>
   <td>The target activity can be safely invoked by the browser to display data 
       referenced by a link &mdash; for example, an image or an e-mail message.
</tr><tr>
   <td><code>CATEGORY_GADGET</code>
   <td>The activity can be embedded inside of another activity that hosts gadgets.
</tr><tr>
   <td><code>CATEGORY_HOME</code>
   <td>The activity displays the home screen, the first screen the user sees when 
       the device is turned on or when the HOME key is pressed.
</tr><tr>
   <td><code>CATEGORY_LAUNCHER</code>
   <td>The activity can be the initial activity of a task and is listed in 
       the top-level application launcher.
</tr><tr>
   <td><code>CATEGORY_PREFERENCE</code>
   <td>The target activity is a preference panel.
</tr>
</table> 

<p>
See the <code><a href="../../../reference/android/content/Intent.html">Intent</a></code> class description for the full list of 
categories.
</p>

<p>
The <code><code><a href="../../../reference/android/content/Intent.html#addCategory(java.lang.String)">addCategory()</a></code></code> method 
places a category in an Intent object, <code><code><a href="../../../reference/android/content/Intent.html#removeCategory(java.lang.String)">removeCategory()</a></code></code> deletes a category previously added, and <code><code><a href="../../../reference/android/content/Intent.html#getCategories()">getCategories()</a></code></code> gets the set of all 
categories currently in the object. 
</p>
</dd>

<p><dt><b>Extras</b><a name="extras"></a></dt>
<dd>Key-value pairs for additional information that should be delivered to the 
component handling the intent.  Just as some actions are paired with particular 
kinds of data URIs, some are paired with particular extras.  For example, an 
<code>ACTION_TIMEZONE_CHANGED</code> intent has a "<code>time-zone</code>" extra that 
identifies the new time zone, and <code>ACTION_HEADSET_PLUG</code> has a 
"<code>state</code>" extra indicating whether the headset is now plugged in or 
unplugged, as well as a "<code>name</code>" extra for the type of headset. 
If you were to invent a <code>SHOW_COLOR</code> action, the color value would
be set in an extra key-value pair.

<p>
The Intent object has a series of <code>put...()</code> methods for inserting various 
types of extra data and a similar  set of <code>get...()</code> methods for reading 
the data.  These methods parallel those for <code><a href="../../../reference/android/os/Bundle.html">Bundle</a></code> objects.  
In fact, the extras can be installed and read as a Bundle using the <code><code><a href="../../../reference/android/content/Intent.html#putExtras(android.content.Intent)">putExtras()</a></code></code> and <code><code><a href="../../../reference/android/content/Intent.html#getExtras()">getExtras()</a></code></code> methods.
</p>
</dd>

<p><dt><b>Flags</b></dt>
<dd>Flags of various sorts.  Many instruct the Android system how to launch an 
activity (for example, which task the activity should belong to) and how to treat 
it after it's launched (for example, whether it belongs in the list of recent 
activities).  All these flags are defined in the Intent class.   
</dd>

</dl>

<p>
The Android system and the applications that come with the platform employ 
Intent objects both to send out system-originated broadcasts and to activate 
system-defined components.  To see how to structure an intent to activate a 
system component, consult the 
<a href="../../../guide/appendix/g-app-intents.html">list of intents</a> 
in the reference.  
</p>


<h2><a name="ires"></a>Intent Resolution</h2>

<p>
Intents can be divided into two groups:
</p>

<ul>
<li><i>Explicit intents</i> designate the target component by its 
name (the <a href="#cname">component name field</a>, mentioned earlier, 
has a value set).  Since component names would generally not be known to 
developers of other applications, explicit intents are typically used 
for application-internal messages &mdash; such as an activity starting 
a subordinate service or launching a sister activity.</li>

<li><p><i>Implicit intents</i> do not name a target (the field for 
the component name is blank).  Implicit intents are often used to 
activate components in other applications.</p></li>   
</ul>

<p>
Android delivers an explicit intent to an instance of the designated 
target class.  Nothing in the Intent object other than the component 
name matters for determining which component should get the intent.  
</p>

<p>
A different strategy is needed for implicit intents.  In the absence of a 
designated target, the Android system must find the best component (or 
components) to handle the intent &mdash; a single activity or service to 
perform the requested action or the set of broadcast receivers to respond 
to the broadcast announcement.  It does so by comparing the contents of 
the Intent object to <i>intent filters</i>, structures associated with 
components that can potentially receive intents.  Filters advertise the 
capabilities of a component and delimit the intents it can handle.  They 
open the component to the possibility of receiving implicit intents of 
the advertised type.  If a component does not have any intent filters, 
it can receive only explicit intents.  A component with filters can 
receive both explicit and implicit intents.
</p>

<p>
Only three aspects of an Intent object are consulted when the object
is tested against an intent filter:
</p>

<p style="margin-left: 2em">action
<br/>data (both URI and data type)
<br/>category</p>

<p>
The extras and flags play no part in resolving which component receives
an intent.
</p>


<h3><a name="ifs"></a>Intent filters</h3>

<p>
To inform the system which implicit intents they can handle, activities, 
services, and broadcast receivers can have one or more intent filters.  
Each filter describes a capability of the component, a set of intents that 
the component is willing to receive.  It, in effect, filters in 
intents of a desired type, while filtering out unwanted 
intents &mdash; but only unwanted implicit intents (those that don't name
a target class).  An explicit intent is always delivered to its target, 
no matter what it contains; the filter is not consulted.  But an implicit 
intent is delivered to a component only if it can pass through one of the 
component's filters.
</p>

<p>
A component has separate filters for each job it can do, each face it can 
present to the user.  For example, the NoteEditor activity of the sample
Note Pad application has two filters &mdash; one for starting up with a
specific note that the user can view or edit, and another for starting 
with a new, blank note that the user can fill in and save.  (All of Note 
Pad's filters are described in the <a href="#npex">Note Pad Example</a>
section, later.)
</p>

<div class="sidebox-wrapper">
<div class="sidebox">
<h2>Filters and security</h2>
<p>An intent filter cannot be relied on for security.  While it opens a
component to receiving only certain kinds of implicit intents, it does 
nothing to prevent explicit intents from targeting the component.  Even 
though a filter restricts the intents a component will be asked to handle
to certain actions and data sources, someone could always put 
together an explicit intent with a different action and data source, and 
name the component as the target.
</p>
</div>
</div> 

<p>
An intent filter is an instance of the <code><a href="../../../reference/android/content/IntentFilter.html">IntentFilter</a></code> class.  
However, since the Android system must know about the capabilities of a component 
before it can launch that component, intent filters are generally not set up in 
Java code, but in the application's manifest file (AndroidManifest.xml) as 
<code><a href="../../../guide/topics/manifest/intent-filter-element.html">&lt;intent-filter&gt;</a></code> 
elements.  (The one exception would be filters for 
broadcast receivers that are registered dynamically by calling <code><code><a href="../../../reference/android/content/Context.html#registerReceiver(android.content.BroadcastReceiver, android.content.IntentFilter, java.lang.String, android.os.Handler)">Context.registerReceiver()</a></code></code>; they are directly created as 
IntentFilter objects.)
</p>

<p>
A filter has fields that parallel the action, data, and category fields of an 
Intent object.  An implicit intent is tested against the filter in all three areas.  
To be delivered to the component that owns the filter, it must pass all three tests.  
If it fails even one of them, the Android system won't deliver it to the 
component &mdash; at least not on the basis of that filter.  However, since a 
component can have multiple intent filters, an intent that does not pass 
through one of a component's filters might make it through on another.
</p>

<p>
Each of the three tests is described in detail below:
</p>

<dl>

<dt><b>Action test</b></dt>
<dd>An 
<code><a href="../../../guide/topics/manifest/intent-filter-element.html">&lt;intent-filter&gt;</a></code>
element in the manifest file lists actions as 
<code><a href="../../../guide/topics/manifest/action-element.html">&lt;action&gt;</a></code> 
subelements.  For example:

<pre>&lt;intent-filter . . . &gt;
    &lt;action android:name="com.example.project.SHOW_CURRENT" /&gt;
    &lt;action android:name="com.example.project.SHOW_RECENT" /&gt;
    &lt;action android:name="com.example.project.SHOW_PENDING" /&gt;
    . . .
&lt;/intent-filter&gt;</pre>

<p>
As the example shows, while an Intent object names just a single action, 
a filter may list more than one.  The list cannot be empty; a filter must 
contain at least one <code>&lt;action&gt;</code> element, or it
will block all intents.
</p>

<p>
To pass this test, the action specified in the Intent object must match 
one of the actions listed in the filter.  If the object or the filter 
does not specify an action, the results are as follows: 
</p>

<ul>
<li>If the filter fails to list any actions, there is nothing for an 
intent to match, so all intents fail the test.  No intents can get 
through the filter.</li>

<li><p>On the other hand, an Intent object that doesn't specify an 
action automatically passes the test &mdash; as long as the filter 
contains at least one action.</p></li>
</ul
</dd>

<dt><b>Category test</b></dt>
<dd>An 
<code><a href="../../../guide/topics/manifest/intent-filter-element.html">&lt;intent-filter&gt;</a></code> 
element also lists categories as subelements.  For example:

<pre>&lt;intent-filter . . . &gt;
    &lt;category android:name="android.intent.category.DEFAULT" /&gt;
    &lt;category android:name="android.intent.category.BROWSABLE" /&gt;
    . . .
&lt;/intent-filter&gt;</pre>

<p>
Note that the constants described earlier for actions and categories are not
used in the manifest file.  The full string values are used instead.  For 
instance, the "<code>android.intent.category.BROWSABLE</code>" string in the example 
above corresponds to the <code>CATEGORY_BROWSABLE</code> constant mentioned earlier 
in this document.  Similarly, the string "<code>android.intent.action.EDIT</code>" 
corresponds to the <code>ACTION_EDIT</code> constant.
</p>

<p>
For an intent to pass the category test, every category in the Intent object 
must match a category in the filter.  The filter can list additional categories, 
but it cannot omit any that are in the intent.
</p>

<p>
In principle, therefore, an Intent object with no categories should always pass 
this test, regardless of what's in the filter.  That's mostly true.  However, 
with one exception, Android treats all implicit intents passed to <code><a href="../../../reference/android/content/Context.html#startActivity(android.content.Intent)">startActivity()</a></code> as if they contained 
at least one category:  "<code>android.intent.category.DEFAULT</code>" (the
<code>CATEGORY_DEFAULT</code> constant).  
Therefore, activities that are willing to receive implicit intents must 
include "<code>android.intent.category.DEFAULT</code>" in their intent filters. 
(Filters with "<code>android.intent.action.MAIN</code>" and 
"<code>android.intent.category.LAUNCHER</code>" settings are the exception.  
They mark activities that begin new tasks and that are represented on the 
launcher screen.  They can include "<code>android.intent.category.DEFAULT</code>" 
in the list of categories, but don't need to.)  See <a href="#imatch">Using
intent matching</a>, later, for more on these filters.)
</p>
<dd>

<dt><b>Data test</b></dt>
<dd>Like the action and categories, the data specification for an intent filter 
is contained in a subelement.  And, as in those cases, the subelement can appear 
multiple times, or not at all.  For example:

<pre>&lt;intent-filter . . . &gt;
    &lt;data android:mimeType="video/mpeg" android:scheme="http" . . . /&gt; 
    &lt;data android:mimeType="audio/mpeg" android:scheme="http" . . . /&gt;
    . . .
&lt;/intent-filter&gt;</pre>

<p>
Each 
<code><a href="../../../guide/topics/manifest/data-element.html">&lt;data&gt;</a></code> 
element can specify a URI and a data type (MIME media type).  There are separate 
attributes &mdash; <code>scheme</code>, <code>host</code>, <code>port</code>, 
and <code>path</code> &mdash; for each part of the URI:  
</p>

<p style="margin-left: 2em"><code>scheme://host:port/path</code></p>

<p>
For example, in the following URI,
</p>

<p style="margin-left: 2em"><code>content://com.example.project:200/folder/subfolder/etc</code></p>

<p> the scheme is "<code>content</code>", the host is "<code>com.example.project</code>", 
the port is "<code>200</code>", and the path is "<code>folder/subfolder/etc</code>".  
The host and port together constitute the URI <i>authority</i>; if a host is 
not specified, the port is ignored.
</p>

<p>
Each of these attributes is optional, but they are not independent of each other:  
For an authority to be meaningful, a scheme must also be specified.  
For a path to be meaningful, both a scheme and an authority must be specified.  
</p>

<p>
When the URI in an Intent object is compared to a URI specification in a filter, 
it's compared only to the parts of the URI actually mentioned in the filter.  
For example, if a filter specifies only a scheme, all URIs with that scheme match 
the filter.  If a filter specifies a scheme and an authority but no path, all URIs 
with the same scheme and authority match, regardless of their paths.  If a filter 
specifies a scheme, an authority, and a path, only URIs with the same scheme, 
authority, and path match.  However, a path specification in the filter can 
contain wildcards to require only a partial match of the path.
</p>

<p>
The <code>type</code> attribute of a <code>&lt;data&gt;</code> element specifies the MIME type 
of the data.  It's more common in filters than a URI.  Both the Intent object and 
the filter can use a "*" wildcard for the subtype field &mdash; for example, 
"<code>text/*</code>" or "<code>audio/*</code>" &mdash; indicating any subtype matches.
</p>

<p>
The data test compares both the URI and the data type in the Intent object to a URI 
and data type specified in the filter.  The rules are as follows:
</p>

<ol type="a">
<li>An Intent object that contains neither a URI nor a data type passes the 
test only if the filter likewise does not specify any URIs or data types.</li>

<li><p>An Intent object that contains a URI but no data type (and a type cannot 
be inferred from the URI) passes the test only if its URI matches a URI in the 
filter and the filter likewise does not specify a type.  This will be the case 
only for URIs like <code>mailto:</code> and <code>tel:</code> that do not refer to actual data.</p></li>

<li><p>An Intent object that contains a data type but not a URI passes the test 
only if the filter lists the same data type and similarly does not specify a URI.</p></li>

<li><p>An Intent object that contains both a URI and a data type (or a data type 
can be inferred from the URI) passes the data type part of the test only if its 
type matches a type listed in the filter.  It passes the URI part of the test 
either if its URI matches a URI in the filter or if it has a <code>content:</code> 
or <code>file:</code> URI and the filter does not specify a URI.  In other words, 
a component is presumed to support <code>content:</code> and <code>file:</code> data if
its filter lists only a data type.</p></li>
</ol>
</dl>

<p>
If an intent can pass through the filters of more than one activity or service, 
the user may be asked which component to activate.  An exception is raised if
no target can be found.
</p>


<h3><a name="ccases"></a>Common cases</h3>

<p>
The last rule shown above for the data test, rule (d), reflects the expectation 
that components are able to get local data from a file or content provider.
Therefore, their filters can list just a data type and do not need to explicitly
name the <code>content:</code> and <code>file:</code> schemes.
This is a typical case.  A <code>&lt;data&gt;</code> element like the following, 
for example, tells Android that the component can get image data from a content 
provider and display it:
</p>

<pre>&lt;data android:mimeType="image/*" /&gt;</pre>

<p>
Since most available data is dispensed by content providers, filters that 
specify a data type but not a URI are perhaps the most common.
</p>

<p>
Another common configuration is filters with a scheme and a data type.  For
example, a <code>&lt;data&gt;</code> element like the following tells Android that
the component can get video data from the network and display it:
</p>

<pre>&lt;data android:scheme="http" android:type="video/*" /&gt;</pre>

<p>
Consider, for example, what the browser application does when
the user follows a link on a web page.   It first tries to display the data 
(as it could if the link was to an HTML page).  If it can't display the data, 
it puts together an implicit intent with the scheme and data type and tries
to start an activity that can do the job.  If there are no takers, it asks the
download manager to download the data.  That puts it under the control
of a content provider, so a potentially larger pool of activities
(those with filters that just name a data type) can respond.
</p>

<p>
Most applications also have a way to start fresh, without a reference
to any particular data.  Activities that can initiate applications 
have filters with "<code>android.intent.action.MAIN</code>" specified as
the action.  If they are to be represented in the application launcher,
they also specify the "<code>android.intent.category.LAUNCHER</code>" 
category:
</p>

<pre>&lt;intent-filter . . . &gt;
    &lt;action android:name="code android.intent.action.MAIN" /&gt;
    &lt;category android:name="code android.intent.category.LAUNCHER" /&gt;
&lt;/intent-filter&gt;</pre>


<h3><a name="imatch"></a>Using intent matching</h3>

<p>
Intents are matched against intent filters not only to discover a target
component to activate, but also to discover something about the set of
components on the device.  For example, the Android system populates the 
application launcher, the top-level screen that shows the applications 
that are available for the user to launch, by finding all the  activities
 with intent filters that specify the "<code>android.intent.action.MAIN</code>" 
action and "<code>android.intent.category.LAUNCHER</code>" category 
(as illustrated in the previous section).  It then displays the icons and 
labels of those activities in the launcher.  Similarly, it discovers the 
home screen by looking for the activity with 
"<code>android.intent.category.HOME</code>" in its filter.
</p>

<p>
Your application can use intent matching is a similar way.
The <code><a href="../../../reference/android/content/pm/PackageManager.html">PackageManager</a></code> has a set of <code>query...()</code>
methods that return all components that can accept a particular intent, and 
a similar series of <code>resolve...()</code> methods that determine the best
component to respond to an intent.  For example, 
<code><a href="../../../reference/android/content/pm/PackageManager.html#queryIntentActivities(android.content.Intent, int)">queryIntentActivities()</a></code> returns a list of all activities that can perform
the intent passed as an argument, and <code><a href="../../../reference/android/content/pm/PackageManager.html#queryIntentServices(android.content.Intent, int)">queryIntentServices()</a></code> returns a similar list of services.  
Neither method activates the components; they just list the ones that
can respond.  There's a similar method, 
<code><a href="../../../reference/android/content/pm/PackageManager.html#queryBroadcastReceivers(android.content.Intent, int)">queryBroadcastReceivers()</a></code>, for broadcast receivers.
</p>

<h2 id="npex">Note Pad Example</h2>

<p>
The Note Pad sample application enables users to browse through a list 
of notes, view details about individual items in the list, edit the items, 
and add a new item to the list.  This section looks at the intent filters
declared in its manifest file.  (If you're working offline in the SDK, you 
can find all the source files for this sample application, including its 
manifest file, at <code>&lt;sdk&gt;/samples/NotePad/index.html</code>.  
If you're viewing the documentation online, the source files are in the 
<a href="../../../resources/samples/index.html">Tutorials and Sample Code</a> 
section <a href="../../../resources/samples/NotePad/index.html">here</a>.)
</p>

<p>
In its manifest file, the Note Pad application declares three activities,
each with at least one intent filter.  It also declares a content provider 
that manages the note data.  Here is the manifest file in its entirety:
</p>

<pre>&lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
          package="com.example.android.notepad"&gt;
    &lt;application android:icon="@drawable/app_notes"
                 android:label="@string/app_name" &gt;

        &lt;provider android:name="NotePadProvider"
                  android:authorities="com.google.provider.NotePad" /&gt;

        &lt;activity android:name="NotesList" android:label="@string/title_notes_list"&gt;
            &lt;intent-filter&gt;
                &lt;action android:name="android.intent.action.MAIN" /&gt;
                &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
            &lt;/intent-filter&gt;
            &lt;intent-filter&gt;
                &lt;action android:name="android.intent.action.VIEW" /&gt;
                &lt;action android:name="android.intent.action.EDIT" /&gt;
                &lt;action android:name="android.intent.action.PICK" /&gt;
                &lt;category android:name="android.intent.category.DEFAULT" /&gt;
                &lt;data android:mimeType="vnd.android.cursor.dir/vnd.google.note" /&gt;
            &lt;/intent-filter&gt;
            &lt;intent-filter&gt;
                &lt;action android:name="android.intent.action.GET_CONTENT" /&gt;
                &lt;category android:name="android.intent.category.DEFAULT" /&gt;
                &lt;data android:mimeType="vnd.android.cursor.item/vnd.google.note" /&gt;
            &lt;/intent-filter&gt;
        &lt;/activity&gt;
        
        &lt;activity android:name="NoteEditor"
                  android:theme="@android:style/Theme.Light"
                  android:label="@string/title_note" &gt;
            &lt;intent-filter android:label="@string/resolve_edit"&gt;
                &lt;action android:name="android.intent.action.VIEW" /&gt;
                &lt;action android:name="android.intent.action.EDIT" /&gt;
                &lt;action android:name="com.android.notepad.action.EDIT_NOTE" /&gt;
                &lt;category android:name="android.intent.category.DEFAULT" /&gt;
                &lt;data android:mimeType="vnd.android.cursor.item/vnd.google.note" /&gt;
            &lt;/intent-filter&gt;
            &lt;intent-filter&gt;
                &lt;action android:name="android.intent.action.INSERT" /&gt;
                &lt;category android:name="android.intent.category.DEFAULT" /&gt;
                &lt;data android:mimeType="vnd.android.cursor.dir/vnd.google.note" /&gt;
            &lt;/intent-filter&gt;
        &lt;/activity&gt;
        
        &lt;activity android:name="TitleEditor" 
                  android:label="@string/title_edit_title"
                  android:theme="@android:style/Theme.Dialog"&gt;
            &lt;intent-filter android:label="@string/resolve_title"&gt;
                &lt;action android:name="com.android.notepad.action.EDIT_TITLE" /&gt;
                &lt;category android:name="android.intent.category.DEFAULT" /&gt;
                &lt;category android:name="android.intent.category.ALTERNATIVE" /&gt;
                &lt;category android:name="android.intent.category.SELECTED_ALTERNATIVE" /&gt;
                &lt;data android:mimeType="vnd.android.cursor.item/vnd.google.note" /&gt;
            &lt;/intent-filter&gt;
        &lt;/activity&gt;
        
    &lt;/application&gt;
&lt;/manifest&gt;</pre>

<p>
The first activity, NotesList, is 
distinguished from the other activities by the fact that it operates 
on a directory of notes (the note list) rather than on a single note.  
It would generally serve as the initial user interface into the 
application.  It can do three things as described by its three intent 
filters:
</p>

<ol>
<li><pre>&lt;intent-filter&gt;
    &lt;action android:name="android.intent.action.MAIN" /&gt;
    &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
&lt;/intent-filter&gt;</pre>

<p>
This filter declares the main entry point into the Note Pad application.  
The standard <code>MAIN</code> action is an entry point that does not require 
any other information in the Intent (no data specification, for example), 
and the <code>LAUNCHER</code> category says that this entry point should be 
listed in the application launcher.
</p></li>

<li><pre>&lt;intent-filter&gt;
    &lt;action android:name="android.intent.action.VIEW" /&gt;
    &lt;action android:name="android.intent.action.EDIT" /&gt;
    &lt;action android:name="android.intent.action.PICK" /&gt;
    &lt;category android:name="android.intent.category.DEFAULT" /&gt;
    &lt;data android:mimeType="vnd.android.cursor.dir/vnd.google.note" /&gt;
&lt;/intent-filter&gt;</pre>

<p>
This filter declares the things that the activity can do on a directory 
of notes.  It can allow the user to view or edit the directory (via
the <code>VIEW</code> and <code>EDIT</code> actions), or to pick a particular note 
from the directory (via the <code>PICK</code> action).
</p> 

<p>
The <code>mimeType</code> attribute of the 
<code><a href="../../../guide/topics/manifest/data-element.html">&lt;data&gt;</a></code> 
element specifies the kind of data that these actions operate on.  It 
indicates that the activity can get a Cursor over zero or more items 
(<code>vnd.android.cursor.dir</code>) from a content provider that holds
Note Pad data (<code>vnd.google.note</code>).  The Intent object that launches
the activity would include a <code>content:</code> URI specifying the exact 
data of this type that the activity should open.
</p>

<p>
Note also the <code>DEFAULT</code> category supplied in this filter.  It's
there because the <code><code><a href="../../../reference/android/content/Context.html#startActivity(android.content.Intent)">Context.startActivity()</a></code></code> and 
<code><code><a href="../../../reference/android/app/Activity.html#startActivityForResult(android.content.Intent, int)">Activity.startActivityForResult()</a></code></code> methods treat all intents 
as if they contained the <code>DEFAULT</code> category &mdash; with just
two exceptions:
</p>

<ul>
<li>Intents that explicitly name the target activity</li>
<li>Intents consisting of the <code>MAIN</code> action and <code>LAUNCHER</code> 
category</li>
</ul>

<p>
Therefore, the <code>DEFAULT</code> category is <em>required</em> for all 
filters &mdash; except for those with the <code>MAIN</code> action and 
<code>LAUNCHER</code> category.  (Intent filters are not consulted for
explicit intents.)  
</p></li>

<li><pre>&lt;intent-filter&gt;
    &lt;action android:name="android.intent.action.GET_CONTENT" /&gt;
    &lt;category android:name="android.intent.category.DEFAULT" /&gt;
    &lt;data android:mimeType="vnd.android.cursor.item/vnd.google.note" /&gt;
&lt;/intent-filter&gt;</pre>

<p>
This filter describes the activity's ability to return a note selected by
the user without requiring any specification of the directory the user should 
choose from.  The <code>GET_CONTENT</code> action is similar to the <code>PICK</code> 
action.  In both cases, the activity returns the URI for a note selected by 
the user.  (In each case, it's returned to the activity that called
<code><code><a href="../../../reference/android/app/Activity.html#startActivityForResult(android.content.Intent, int)">startActivityForResult()</a></code></code> to start the NoteList activity.)  Here, 
however, the caller specifies the type of data desired instead of the 
directory of data the user will be picking from.
</p>

<p>
The data type, <code>vnd.android.cursor.item/vnd.google.note</code>, 
indicates the type of data the activity can return &mdash; a URI for 
a single note.  From the returned URI, the caller can get a Cursor for 
exactly one item (<code>vnd.android.cursor.item</code>) from the content 
provider that holds Note Pad data (<code>vnd.google.note</code>).
</p>

<p>
In other words, for the <code>PICK</code> action in the previous filter, 
the data type indicates the type of data the activity could display to the 
user.  For the <code>GET_CONTENT</code> filter, it indicates the type of data 
the activity can return to the caller.
</p></li>
</ol>

<p>
Given these capabilities, the following intents will resolve to the
NotesList activity:
</p>

<dl style="margin-left: 2em">
<dt>action: <code>android.intent.action.MAIN</code></dt>
<dd>Launches the activity with no data specified.</dd>

<dt>action: <code>android.intent.action.MAIN</code>
<br/>category: <code>android.intent.category.LAUNCHER</code></dt>
<dd> Launches the activity with no data selected specified. 
This is the actual intent used by the Launcher to populate its top-level 
list.  All activities with filters that match this action and category
are added to the list.</dd>

<dt>action: <code>android.intent.action.VIEW</code>
<br/>data: <code>content://com.google.provider.NotePad/notes</code></dt>
<dd>Asks the activity to display a list of all the notes under
<code>content://com.google.provider.NotePad/notes</code>.  The user can then 
browse through the list and get information about the items in it.</dd>

<dt>action: <code>android.intent.action.PICK</code>
<br/>data: <code>content://com.google.provider.NotePad/notes</code></dt>
<dd>Asks the activity to display a list of the notes under
<code>content://com.google.provider.NotePad/notes</code>.
The user can then pick a note from the list, and the activity will return 
the URI for that item back to the activity that started the NoteList activity.</dd>

<dt>action: <code>android.intent.action.GET_CONTENT</code>
<br/>data type: <code>vnd.android.cursor.item/vnd.google.note</code></dt>
<dd>Asks the activity to supply a single item of Note Pad data.</dd>
</dl>

<p>
The second activity, NoteEditor, shows 
users a single note entry and allows them to edit it.  It can do two things 
as described by its two intent filters:

<ol>
<li><pre>&lt;intent-filter android:label="@string/resolve_edit"&gt;
    &lt;action android:name="android.intent.action.VIEW" /&gt;
    &lt;action android:name="android.intent.action.EDIT" /&gt;
    &lt;action android:name="com.android.notepad.action.EDIT_NOTE" /&gt;
    &lt;category android:name="android.intent.category.DEFAULT" /&gt;
    &lt;data android:mimeType="vnd.android.cursor.item/vnd.google.note" /&gt;
&lt;/intent-filter&gt;</pre>

<p>
The first, primary, purpose of this activity is to enable the user to 
interact with a single note &mdash; to either <code>VIEW</code> the note or 
<code>EDIT</code> it.  (The <code>EDIT_NOTE</code> category is a synonym for 
<code>EDIT</code>.)  The intent would contain the URI for data matching the 
MIME type <code>vnd.android.cursor.item/vnd.google.note</code> &mdash;
that is, the URI for a single, specific note.  It would typically be a 
URI that was returned by the <code>PICK</code> or <code>GET_CONTENT</code> 
actions of the NoteList activity.
</p>

<p>
As before, this filter lists the <code>DEFAULT</code> category so that the 
activity can be launched by intents that don't explicitly specify the
NoteEditor class.
</p></li>

<li><pre>&lt;intent-filter&gt;
    &lt;action android:name="android.intent.action.INSERT" /&gt;
    &lt;category android:name="android.intent.category.DEFAULT" /&gt;
    &lt;data android:mimeType="vnd.android.cursor.dir/vnd.google.note" /&gt;
&lt;/intent-filter&gt;</pre>

<p>
The secondary purpose of this activity is to enable the user to create a new 
note, which it will <code>INSERT</code> into an existing directory of notes.  The 
intent would contain the URI for data matching the MIME type
<code>vnd.android.cursor.dir/vnd.google.note</code> &mdash; that 
is, the URI for the directory where the note should be placed.
</p></li>  
</ol>

<p>
Given these capabilities, the following intents will resolve to the
NoteEditor activity:
</p>

<dl style:"margin-left: 2em">
<dt>action: <code>android.intent.action.VIEW</code>
<br/>data: <code>content://com.google.provider.NotePad/notes/<var>ID</var></code></dt>
<dd>Asks the activity to display the content of the note identified 
by <code><var>ID</var></code>. (For details on how <code>content:</code> URIs
specify individual members of a group, see 
<a href="../../../guide/topics/providers/content-providers.html">Content Providers</a>.)

<dt>action: <code>android.intent.action.EDIT</code>
<br/>data: <code>content://com.google.provider.NotePad/notes/<var>ID</var></code></dt>
<dd>Asks the activity to display the content of the note identified 
by <code><var>ID</var></code>, and to let the user edit it.  If the user 
saves the changes, the activity updates the data for the note in the 
content provider.</dd>

<dt>action: <code>android.intent.action.INSERT</code>
<br/>data: <code>content://com.google.provider.NotePad/notes</code></dt>
<dd>Asks the activity to create a new, empty note in the notes list at
<code>content://com.google.provider.NotePad/notes</code>
and allow the user to edit it.  If the user saves the note, its URI
is returned to the caller.
</dd>
</dl>

<p>The last activity, TitleEditor, 
enables the user to edit the title of a note.  This could be implemented 
by directly invoking the activity (by explicitly setting its component 
name in the Intent), without using an intent filter.  But here we take 
the opportunity to show how to publish alternative operations on existing 
data:
</p>

<pre>&lt;intent-filter android:label="@string/resolve_title"&gt;
    &lt;action android:name="com.android.notepad.action.EDIT_TITLE" /&gt;
    &lt;category android:name="android.intent.category.DEFAULT" /&gt;
    &lt;category android:name="android.intent.category.ALTERNATIVE" /&gt;
    &lt;category android:name="android.intent.category.SELECTED_ALTERNATIVE" /&gt;
    &lt;data android:mimeType="vnd.android.cursor.item/vnd.google.note" /&gt;
&lt;/intent-filter&gt;</pre>

<p>
The single intent filter for this activity uses a custom action called
"<code>com.android.notepad.action.EDIT_TITLE</code>".  It must be invoked on
a specific note (data type <code>vnd.android.cursor.item/vnd.google.note</code>),
like the previous <code>VIEW</code> and <code>EDIT</code> actions.  However, here the 
activity displays the title contained in the note data, not the content of 
the note itself.
</p>

<p>
In addition to supporting the usual <code>DEFAULT</code> category, the title 
editor also supports two other standard categories: 
<code><code><a href="../../../reference/android/content/Intent.html#CATEGORY_ALTERNATIVE">ALTERNATIVE</a></code></code>
and <code><code><a href="../../../reference/android/content/Intent.html#CATEGORY_SELECTED_ALTERNATIVE">SELECTED_ALTERNATIVE</a></code></code>.
These categories identify activities that can be presented to users in 
a menu of options (much as the <code>LAUNCHER</code> category identifies 
activities that should be presented to user in the application launcher).  
Note that the filter also supplies an explicit label (via 
<code>android:label="@string/resolve_title"</code>) to better control
what users see when presented with this activity as an alternative
action to the data they are currently viewing.  (For more information 
on these categories and building options menus, see the 
<code><code><a href="../../../reference/android/content/pm/PackageManager.html#queryIntentActivityOptions(android.content.ComponentName, android.content.Intent[], android.content.Intent, int)">PackageManager.queryIntentActivityOptions()</a></code></code> and 
<code><code><a href="../../../reference/android/view/Menu.html#addIntentOptions(int, int, int, android.content.ComponentName, android.content.Intent[], android.content.Intent, int, android.view.MenuItem[])">Menu.addIntentOptions()</a></code></code>
methods.)
</p>

<p>
Given these capabilities, the following intent will resolve to the
TitleEditor activity:
</p>

<dl style="margin-left: 2em">
<dt>action: <code>com.android.notepad.action.EDIT_TITLE</code>
<br/>data: <code>content://com.google.provider.NotePad/notes/<var>ID</var></code></dt>
<dd>Asks the activity to display the title associated with note <var>ID</var>, and 
allow the user to edit the title.</dd>
</dl>






  





    </div>

  <a href="#top" style="float:right">&uarr; Go to top</a>
  
  </div>

<div id="footer">


  <div id="copyright">
    
  Except as noted, this content is licensed under <a
  href="http://www.apache.org/licenses/LICENSE-2.0">Apache 2.0</a>. 
  For details and restrictions, see the <a href="../../../license.html">
  Content License</a>.
  </div>
  <div id="build_info">
    
  Android 4.0&nbsp;r1 - 17 Oct 2011 18:17

  </div>

  <div id="footerlinks">
    
  <p>
    <a href="http://www.android.com/terms.html">Site Terms of Service</a> -
    <a href="http://www.android.com/privacy.html">Privacy Policy</a> -
    <a href="http://www.android.com/branding.html">Brand Guidelines</a>
  </p>
  </div>

</div> <!-- end footer -->

</div><!-- end doc-content -->

</div> <!-- end body-content --> 

<script type="text/javascript">
init(); /* initialize android-developer-docs.js */
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-5831155-1");
pageTracker._trackPageview();
</script>

</body>
</html>



